package com.springBoot.springBootSysCore.modules.controller.api.system;

import com.springBoot.springBootSysCore.common.utils.returnUtil.AjaxJson;
import com.springBoot.springBootSysCore.modules.controller.web.base.BaseController;
import com.springBoot.springBootSysCore.modules.entity.system.SysFeedBack;
import com.springBoot.springBootSysCore.modules.services.system.SysFeedBackService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 *反馈
 */
@RestController
@RequestMapping("${apiPath}/auth/sysFeedBack")
public class SysFeedBackControllerApi extends BaseController<SysFeedBack,String> {
    @Autowired
    private SysFeedBackService sysFeedBackService;

    @RequestMapping(value="add",method= RequestMethod.POST)
    public Object applyOfflineCourse(SysFeedBack entity, HttpServletRequest request, Model model, HttpServletResponse response) throws Exception {
        if (!beanValidator(model, entity)){
            return renderString(response, new AjaxJson().setMsg(model.asMap().get("message").toString()).setSuccess(false));
        }
        return  sysFeedBackService.appAdd(entity,request);
    }
}
